#!/bin/bash
HOST="ecs2.zhangjianyong.top"
jenv local 1.8 && mvn clean package -DskipTests || { echo "构建失败，中止"; exit 1; }

scp target/z-tools-api-0.0.1-SNAPSHOT.jar root@$HOST:~/tools/
sleep 1
# 获取参数
if [ "$1" = "debug" ]; then
    echo "debug"
    ssh root@$HOST "sh ~/tools/restart_debug.sh"
else
    echo "release"
    ssh root@$HOST "sh ~/tools/restart.sh"
fi
